import React from "react";
import PropTypes from "prop-types";
import {Button, Form} from "antd";
import paramsFilter from '@/utils/paramsFilter'
import {connect} from 'react-redux'

const Item = Form.Item;

class searchForm extends React.Component {

    formRef = React.createRef();
    //获取搜索框的方法
    getFormValue = () => {
        return paramsFilter(this.formRef.current.getFieldsValue())
    }

    render() {
        const {onFinish} = this.props;
        return (
            <Form
                layout={"inline"}
                ref={(ref) => {
                    this.formRef = ref
                }}
                onFinish={onFinish}>
                <Item label="菜单名称" name="menuName">
                    <React.FormInput placeholder='请输入菜单名称'/>
                </Item>
                <Item>
                    <Button type="primary" htmlType="submit">
                        查询
                    </Button>
                </Item>
            </Form>
        );
    }
}

searchForm.propTypes = {
    onFinish: PropTypes.func.isRequired,
    add: PropTypes.func.isRequired
};

const mapStateToProps = state => {
    return {
        areaCode: state.areaCodeSelectValue,
    };
};

const mapDispatchToProps = (dispatch) => {
    return {
        setAreaCode: data => {
            dispatch({type: 'setCode', data})
        },
    }
}
export default connect(mapStateToProps, mapDispatchToProps)(searchForm);
